重磅!这可能是最全的面板门槛回归汇总了
来源 | 数量经济学综合整理
转载请联系
进行回归分析,一般需要研究系数的估计值是否稳定。很多经济变量都存在结构突变问题,使用普通回归的做法就是确定结构突变点,进行分段回归。这就像我们高中学习的分段函数。但是对于大样本、面板数据如何寻找结构突变点。所以本文在此讲解面板门限回归的问题,门限回归也适用于时间序列(文章后面将介绍stata15.0新命令进行时间序列的门限回归)。
门限效应,是指当一个经济参数达到特定的数值后,引起另外一个经济参数发生突然转向其它发展形式的现象(结构突变)。作为原因现象的临界值称为门限值。例如,成果和时间存在非线性关系,但是在每个阶段是线性关系。有些人将这样的模型称为门槛模型,或者门限模型。如果模型的研究对象包含多个个体多个年度,那么就是门限面板模型。
常见模型如下:门槛回归模型(threshold regression,也称门限回归):
汉森(Bruce E. Hansen)在门限回归模型上做出了很多贡献。 Hansen于1996年在《Econometrica》上发表文章《Inference when a nuisance parameter is not identified under the null hypothesis》,提出了时间序列门限自回归模型(TAR)的估计和检验。之后,他在门限模型上连续追踪,发表了几篇经典文章,尤其是1999年的《Threshold effects in non-dynamic panels: Estimation, testing and inference》(Hansen (1999) 首次介绍了具有个体效应的面板门限模型的计量分析方法, 该方法以残差平方和最小化为条件确定门限值, 并检验门限值的显著性, 克服了主观设定结构突变点的偏误。具体思路是:选定某一变量作为门限变量, 根据搜寻到的门限值将回归模型区分为多个区间, 每个区间的回归方程表达不同, 根据门限划分的区间将其他样本值进行归类, 回归后比较不同区间系数的变化。),2000年的《Sample splitting and threshold estimation》和2004年与他人合作的《Instrumental Variable Estimation of a Threshold Model》。
在这些文章中,Hansen介绍了包含个体固定效应的静态平衡面板数据门限回归模型,阐述了计量分析方法。方法方面,首先要通过减去时间均值方程,消除个体固定效应,然后再利用OLS(最小二乘法)进行系数估计。如果样本数量有限,那么可以使用自举法(Bootstrap)重复抽取样本,提高门限效应的显著性检验效率。 在Hansen(1999)的模型中,解释变量中不能包含内生解释变量,无法扩展应用领域。Caner和Hansen在2004年解决了这个问题。他们研究了带有内生变量和一个外生门限变量的面板门限模型。与静态面板数据门限回归模型有所不同,在含有内生解释变量的面板数据门限回归模型中,需要利用简化型对内生变量进行一定的处理,然后用2SLS(两阶段最小二乘法)或者GMM(广义矩估计)对参数进行估计。
接下来本文为大家介绍stata15.0进行门限回归新命令threshold以及王群勇老师编写的xthreg、xtptm和连玉君老师编写的命令。
二、Stata 15门槛回归:threshold
阈值将一个状态从另一个状态描述出来。有一个效应(一组系数)达到阈值和另一个效应(另一组系数)。Stata的新门限命令适用于时间序列。门槛模型常用于时间序列数据。门槛可以是一个时间。例如,如果你认为投资策略在某个未知的日期发生了变化,你可以用一个模型来获得日期的估计,并在它前后得到不同系数的估计。或者门槛值可以用另一个变量来表示。例如,在一定程度的通货膨胀之外,央行会提高利率。你可以用一个模型来得到门槛值的估计值和两边的系数。
在Stata 15中,进行门槛回归的命令为threshold,语法格式为:threshold depvar [indepvars] [if] [in], threshvar(varname) [options]
其中,其中, depvar为被解释变量,indepvars为相关变量(解释变量)。必选项 threshvar(varname) 表示变量 varname为门槛变量,选项nthresholds(#)指的是number of thresholds,这个命令默认只有一个门槛值(default is nthresholds(1))。也可以通过选择项 nthresholds(#) 来指定多个门槛值,比如 nthresholds(2) 表示有 2 个门槛值,not allowed with optthresh()。
optthresh(#[, ictype]), select optimal number of thresholds less than or equal to #; not allowed with nthresholds(),计算最优的门槛个数,一般有Bayesian information criterion (BIC)、Akaike information criterion (AIC) 、Hannan-Quinn information criterion (HQIC)三个信息准则。其中默认使用BIC信息准则进行选择。
菜单操作步骤为:Statistics > Time series > Threshold regression model
门槛回归Example
调用数据:
webuse usmacro
下面进行门限回归
threshold fedfunds, regionvars(l.fedfunds inflation ogap) threshvar(l2.ogap)
threshold fedfunds, regionvars(l.fedfunds inflation ogap) threshvar(l2.ogap) optthresh(5)
▲图:结果输出
三、王群勇老师xthreg命令
xthreg需要stata13及以上版本
语法格式为:
xthreg depvar [indepvars] [if] [in], rx(varlist) qx(varname) [thnum(#) grid(#) trim(numlist) bs(numlist) thlevel(#) gen(newvarname) noreg nobslog thgiven options]
depvar被解释变量,indepvars 解释变量,qx(varname) is the threshold variable,门限变量,thnum(#) is the number of thresholds,在stata13.0中门槛值是必要项目,需要等于大于1,小于等于3,默认值为1,也就是至少存在三个门槛值。
rx(varlist) is the regime-dependent variable. Time-series operators are allowed. rx() is required. 区制变量或者制度变量
qx(varname) is the threshold variable. Time-series operators are allowed. qx() is required. 门限变量或者门槛变量
thnum(#) is the number of thresholds. In the current version (Stata 13), # must be equal to or less than 3. The default is thnum(1). 门槛个数
grid(#) is the number of grid points. grid() is used to avoid consuming too much time when computing large samples. The default is grid(300). 网格点数
trim(numlist) is the trimming proportion to estimate each threshold. The number of trimming proportions must be equal to the number of thresholds specified in thnum(). The default is trim(0.01) for all thresholds. For example, to fit a triple-threshold model, you may set trim(0.01 0.01 0.05).
bs(numlist) is the number of bootstrap replications. If bs() is not set, xthreg does not use bootstrap for the threshold-effect test. bootstrap迭代次数
thlevel(#) specifies the confidence level, as a percentage, for confidence intervals of the threshold. The default is thlevel(95). 置信区间,默认为95%,即thlevel(95)
gen(newvarname) generates a new categorical variable with 0, 1, 2, ... for each regime. The default is gen(_cat).
noreg suppresses the display of the regression result. 不显示回归结果
nobslog suppresses the iteration process of the bootstrap. 不显示bootstrap迭代过程
thgiven fits the model based on previous results. options are any options available for [XT] xtreg.
Time-series operators are allowed in depvar, indepvars, rx(), and qx().
门槛回归的案例
use hansen1999
Estimate a single-threshold model
xthreg i q1 q2 q3 d1 qd1, rx(c1) qx(d1) thnum(1) trim(0.01) grid(400) bs(300)
Estimate a triple-threshold model given the estimated result above
xthreg i q1 q2 q3 d1 qd1, rx(c1) qx(d1) thnum(3) trim(0.01 0.01 0.05) grid(400) bs(300 300 300)
输出结果包括四个部分。第一部分输出门限估计值和自举法的结果。第二部分列表输出门限值及置信区间,Th-1代表单一门限估计值,Th-21 和Th-22代表双门限回归的两个估计值,有时Th-21和Th-1相同。第三部分列出了门限检验,包括RSS、MSE、F统计量及概率值,以及10%、5%、1%的置信水平。第四部分是固定效应回归结果。
王群勇老师xtptm命令在此不做介绍,有兴趣可以尝试。
四、连玉君老师xtthres命令
语法格式为:xtthres varlist [if] [in] , thres(varname) dthres(varname) [ qn(#) bs1(#) bs2(#) bs3(#) levle(#) minobs(#) ]
thres(varname) specifies threshold variable, as denoted by q_it in Hansen(1999). Note that this option should not be omitted.
dthres(varname) specifies the variable that will show threshold effects, as denoted by x_it in Hansen(1999). This variable will be multipled by the indicator function I(.). Note that this option should not be omitted either.
qn(#) specifies the number of distinct values to be search in finding out the optimal estimate of threshold effects, r_hat, which will minimize the sum of square residuals of the model. The default value is 400.
bs1(#), bs2(#), bs3(#) specify the Bootstrap times in single threshold, double threshold and triple threshold model respectively. The default values are all 300.
level(#) specifies the confidence level, in percent, for confidence intervals. The default is level(95) or as set by set level; see help level.
minobs specifies the minimum number of observations in each of the regimes when searching for r_hats. The default is 10.
案例介绍1
xtthres tobin size tang prof, th(grow) d(tl)
xtthres tobin size tang prof, th(grow) d(tl) bs2(200) bs3(100) minobs(30)
xtthres tobin size tang prof if year<=2001, th(grow) d(tl) qn(200)
案例介绍2
cd E:\stata\results //设置工作路径,保存输出结果
use E:\stata\personal18\data\hansen1999, clear // 调入 Hansen99 数据
*-Table 1: Summary statistics
tabstat i q1 c1 d1, s(min p25 p50 p75 max) format(%6.3f) c(s)
Estimating
xtthres i q1 q2 q3 d1 qd1, th(d1) d(c1) min(120) bs1(300) bs2(300) bs3(200)
五、门限回归Eviews操作
阈值回归模型描述了一种简单的非线性回归模型。 TR规范很受欢迎,因为它们很容易。 估计和解释,并能产生有趣的非线性和丰富的动力学。 在TR的应用中,有样品分裂,多重平衡。 非常流行的阈值自回归(TAR)和自激励阈值自回归(SETAR)(Hansen 1999, 2011;波特2003)。
在功能强大的特性中,Eviews有选择最佳阈值TR模型选择工具。 能够从候选列表中,并且能够指定两种状态的变化和非变化的变量。例如,您可以轻松地指定两种模式的门限模型并允许EViews 估计最优变量和参数、阈值、系数和协方差。 并对变化和回归参数的估计。
Smooth Threshold Regression Estimation
EViews 9以及10.0新功能:Smooth Threshold Regression Estimation
Smooth Transition Autoregressive (STAR) modeling (Teräsvirta, 1994) is an extremely popular approach for nonlinear time series analysis. STAR models, which are a special case of Smooth Transition Regression (STR) models, embed regime-dependent linear auto-regression specifications in a smooth transition nonlinear regression framework.
EViews tools for estimation of two-regime STR models with unknown parameters for the shape and location of the smooth threshold. EViews estimation supports several different transition functions, provides model selection tools for selecting the best threshold variable from a candidate list, and offers the ability to specify regime varying and non-varying variables and variables that appear in only one regime.
To estimate a smooth transition model, Quick/Estimate Equation... from the main EViews menu, select THRESHOLD - Threshold Regression from the main Method dropdown menu near the bottom of the dialog, and click on the Smooth radio button in the Threshold type setting.
The options page allows you specify the transition function, covariance estimation method (including various robust estimators), and optimization settings.
Following estimation, EViews offers specialized views for the transition function and weights along with support for tests for linearity against STR alternatives and tests of no remaining nonlinearity and parameter constancy, alongside conventional tests for heteroskedasticity and serial correlation.
门限回归模型是一种重要的结构变化模型,当观测变量通过未知门限时,函数模型具有分段线性的特征,并且区制发生变化。门限回归模型很容易估计和解释,再加上它具备动态性,所以应用比较广泛。门限回归能够应用于多种模型中。
门限变量qt和解释变量Xt、Zt的特征决定了门限函数的类型。如果qt是yt的d期滞后值,则称为自激励(SE)模型;如果门限变量不是被解释变量的滞后变量,则为一般的门限回归(TR)模型。如果解释变量Xt、Zt中仅包含截距项和滞后的被解释变量,则表示自回归(AR)模型。在此基础上易于得出,自激励门限自回归(SETAR)模型中则包括自回归设定和滞后被解释变量两类要素。
Threshold Estimation in EViews
To estimate a threshold regression in EViews, select Object/New Object.../Equation or Quick/Estimate Equation... from the main EViews menu, then select Threshold - Thresh- old Regression in the Method drop-down menu. Alternatively, type threshold in the com- mand window and press Enter. You will see the following dialog:
stata15.0新命令threshold所用数据
Estimation Output
Criteria Graph and Table If you select View/Model Selection Summary from an estimated threshold equation you will be offered a choice of displaying a Criteria Graph or a Criteria Table:
These two views display the model selection criteria used to select the threshold variable in a line plot or a table, ordered by the selection criterion. For example, the criteria graph for this equation is shown below:
In this figure, the threshold variable whose model has the lowest AIC is clearly visible on the left of the graph. Here, we see the same set of results in table form. This view also includes information about the common sample used for model selection estimation, and the number of regimes employed for each candidate model.
六、参考文献及资源下载
计量经济分析方法与建模:EViews应用及实例
Hansen, Bruce E., 2000. "Sample Splitting and Threshold Estimation," Econometrica, 68, 575-603.(门槛回归Bruce Hansen 在其个人网页所提供的非官方 Stata 命令 ,下载地址为: http://www.ssc.wisc.edu/~bhansen/progs/progs_threshold.html)
Hansen, B. E. 1999. Threshold effects in non-dynamic panels: Estimation, testing, and inference. Journal of Econometrics 93: 345-368.
Wang, Qunyong, 2015. "Fixed-effect Panel Threshold Model Using Stata," The Stata Journal, 15(1), 121-134.
连玉君,程建. 不同成长机会下资本结构与经营绩效之关系研究. 当代经济科学,2006(2):97-103.
资源下载
Bruce E. Hansen "Sample splitting and threshold estimation" Econometrica (2000)中关于R、Stata、Gauss 、Matlab等软件的Programs and Data下载地址为:https://www.ssc.wisc.edu/~bhansen/progs/ecnmt_00.html
由于作者计量经济学理论功底以及操作实践的局限性,文中难免有错误,请读者批评指正,更多关于门限回归的资源以及意见,欢迎留言交流。